//-------------------------new----------------------------------

export const voice_onoff_new = function (_, generator) {
    generator.definitions_['import player'] = 'import player';
    var key = generator.valueToCode(this, 'key', generator.ORDER_ATOMIC);
    var code = "player.voice_en(" + key + ")\n";
    return code;
}

//----------------------------------------------

export const audio_play_new = function (_, generator) {
    generator.definitions_['import player'] = 'import player';
    var path = generator.valueToCode(this, 'path', generator.ORDER_ATOMIC);
    var volume = generator.valueToCode(this, 'volume', generator.ORDER_ATOMIC);
    var code = "player.audio_play(" + path + "," + volume + ")\n";
    return code;
}

export const audio_record_new = function (_, generator) {
    generator.definitions_['import player'] = 'import player';
    var path = generator.valueToCode(this, 'path', generator.ORDER_ATOMIC);
    var time = generator.valueToCode(this, 'time', generator.ORDER_ATOMIC);
    var code = "player.audio_record(" + path + "," + time + ")\n";
    return code;
}

export const video_play_new = function (_, generator) {
    generator.definitions_['import player'] = 'import player';
    var path = generator.valueToCode(this, 'path', generator.ORDER_ATOMIC);
    var volume = generator.valueToCode(this, 'volume', generator.ORDER_ATOMIC);
    var code = "player.video_play(" + path + "," + volume + ")\n";
    return code;
}

export const video_record_new = function (_, generator) {
    generator.definitions_['import player'] = 'import player';
    var path = generator.valueToCode(this, 'path', generator.ORDER_ATOMIC);
    var time = generator.valueToCode(this, 'time', generator.ORDER_ATOMIC);
    var code = "player.video_record(" + path + "," + time + ")\n";
    return code;
}

//---------------TABIT 音频播放资源（I2S模式）---20230520--------------------
export const audio_tabit_play = function (_, generator) {
    generator.definitions_['import player'] = 'import player';
    var path = generator.valueToCode(this, 'path', generator.ORDER_ATOMIC);
    var volume = generator.valueToCode(this, 'volume', generator.ORDER_ATOMIC);
    var code = "player.audio_play(" + path + "," + volume + ",0)\n";
    return code;
}

export const video_tabit_play = function (_, generator) {
    generator.definitions_['import player'] = 'import player';
    var path = generator.valueToCode(this, 'path', generator.ORDER_ATOMIC);
    var volume = generator.valueToCode(this, 'volume', generator.ORDER_ATOMIC);
    var code = "player.video_play(" + path + "," + volume + ",0)\n";
    return code;
}